<template>
	<view class="weChatBangDing">
		<view @click="clickBangDingButton">绑定</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onLoad(e) {
			
		},
		methods: {
			clickBangDingButton(){
				uni.showLoading();
				uni.login({
					provider:'weixin',
					success: (res) => {
						this.weixinCode = res.code;
						this.postWeChatLoginOne();
					}
				})
			},
			postWeChatLoginOne(){
				this.$_request(
					"POST","/api/wechat-login/mini-program/oauth",
					{
						"code":this.weixinCode,
					},
					(res) => {
						uni.hideLoading()
						uni.navigateBack();
					}
				)
			}
		}
	}
</script>

<style lang="scss">
.weChatBangDing{
	width: 100%;
	height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	view{
		width: 300rpx;
		height: 100rpx;
		background: $theme;
		color: #FFF;
		font-size: 28rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}
}
</style>
